%!PS-Adobe-3.0
%%Title: Diplomacy Map
%%Creator: dpmap, using a map created with DPeye
%%DocumentPaperSizes: Letter
%%LanguageLevel: 2
%%Orientation: Landscape
%%Pages: (atend)
%%DocumentNeededResources: font Helvetica-Bold Courier Courier-Bold Times-Roman
%%+ font Helvetica
%%EndComments

%%BeginDefaults
%%PageResources: font Helvetica-Bold Courier Courier-Bold Times-Roman Helvetica
%%EndDefaults

% INFO
% MAP

%%BeginSetup
%<Play Setup /$SpaceChar 32 /$PaintScaleFactor 1 /$MapUnitScale>
%<+ $MapDrawingScale /$FixedFontHeightRatio 1 /$MapNumberScale $MapDrawingScale>
%<+ /$FrameMargin {$FrameThickness $FrameMarginRatio mul} /$MapUnitLetterSize>
%<+ 14 /$TextFontWidthRatio $FixedFontWidthRatio /$MapImageLeft 0 /$PageHeight>
%<+ 612 /$MapImageRight 61 /$SwitchToMapMode SwitchToMapMode /$FindFont>
%<+ findfont /$InitModes {/FinishReport {} def /InTextMode true def}>
%<+ /$MapUnitOffsetX 0 /$TextFontHeight { $TextFontHeightRatio $TextFontSize>
%<+ mul } /$MapUnitOffsetY 8 /$MapNameOffsetX 0 /$FixedFontWidthRatio .6>
%<+ /$MapNameOffsetY -14 /$TextFontHeightRatio $FixedFontHeightRatio>
%<+ /$PageWidth 792 /$AbsoluteRoundingError 0 /$MapImageWidth { $MapImageRight>
%<+ $MapImageLeft sub } /$MaxNumberLength 4 /$MapNameFontSize 14 /$MapImageTop>
%<+ 76 /$MapNumberSize 14 /$MapSupplyScale $MapDrawingScale /$TextFontWidth {>
%<+ $TextFontWidthRatio $TextFontSize mul } /$MapImageBottom 0 /$MapNameScale>
%<+ $MapUnitScale /$FrameThickness 4 /$FrameMarginRatio .5 /$FinishModes {>
%<+ InTextMode { FinishReport } { r } ifelse } /$MapImageHeight { $MapImageTop>
%<+ $MapImageBottom sub } /$MapDrawingScale .1>

%<Play Definitions>

%<Act Shorthand>
/bd { bind def } bind def
/xd { exch def } bd
/ld { load def } bd
%</Act>

%<Sketch Math>
%$ /ifloor { $AbsoluteRoundingError add floor cvi } bd
/ifloor { .001 add floor cvi } bd
%$ /iceiling { $AbsoluteRoundingError sub ceiling cvi } bd
/iceiling { .001 sub ceiling cvi } bd
/min { 2 copy gt { exch } if pop } bd
/max { 2 copy lt { exch } if pop } bd
/secure_atan { 2 copy 0 eq exch 0 eq and { pop pop 0 } { atan } ifelse } bd
/center { 3 2 roll add 2 div 3 1 roll add 2 div exch } bd
%</Sketch>

%<Scene PaintOperators /operator ld /format {name name}>
/a /arc ld
/c /curveto ld
/d /setdash ld
/f /fill ld
/h /show ld
/k /stroke ld
/l /lineto ld
/m /moveto ld
/n /newpath ld
/o /rotate ld
/p /closepath ld
/r /grestore ld
/s /gsave ld
/t /translate ld
/w /setlinewidth ld
/x /scale ld
/y /scalefont ld
/z /setfont ld
%</Scene>

%<Act Powers>
/Powers 20 dict def
%</Act>

%<Sketch MapUnitDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapUnitLetterFont /Helvetica-Bold $FindFont $MapUnitLetterSize y def
/MapUnitLetterFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch MapNameDefinitions>
%%IncludeResource: font Helvetica-Bold
%$ /MapNameFont /Helvetica-Bold $FindFont $MapNameFontSize y def
/MapNameFont /Helvetica-Bold findfont 14 y def
%</Sketch>

%<Sketch TextColumnDefinitions>
%%IncludeResource: font Courier
%$ /TextFixedFont /Courier $FindFont def
/TextFixedFont /Courier findfont def
%</Sketch>

%<Sketch TextHeadingDefinitions>
%%IncludeResource: font Courier-Bold
%$ /TextHeadingFont /Courier-Bold $FindFont def
/TextHeadingFont /Courier-Bold findfont def
%</Sketch>

%<Sketch TextTitleDefinitions>
%%IncludeResource: font Times-Roman
%$ /TextTitleFont /Times-Roman $FindFont def
/TextTitleFont /Times-Roman findfont def
%</Sketch>

%<Sketch MapNumberDefinitions>
%%IncludeResource: font Helvetica
%$ /MapNumberFont /Helvetica $FindFont $MapNumberSize y def
/MapNumberFont /Helvetica findfont 14 y def
%</Sketch>

%</Play>

%<Play Chapters /references {() PageLayout MapImageScale} /define bd>

%<Chapter PageSetup>
/PageSetup {

%<Sketch TurnLandscape>
	%$ $PageHeight 0 t
	612 0 t
	90 o
%</Sketch>

%<Sketch SetupGState>
	%$ $InitModes
	/FinishReport { } def /InTextMode true def
	Black
%</Sketch>

} bd
%</Chapter>

%<Chapter ShowPage>
/ShowPage {
	DrawAliases
	%$ $FinishModes
	InTextMode { FinishReport } { r } ifelse

%<Part none/>

	showpage
} bd
%</Chapter>

%<Chapter VisitColors /define def>
/VisitColors {
	3 dict begin
	/c xd /r xd /g xd

%<Scene GrayColors /operator g /format {name 1}>
	/BorderBlack .1 g
	/MountainGrey .5 g
	/IceGrey .9 g
	/ArrowBlack 0 g
	/ArrowWhite .9 g
	/Black 0 g
	/White .9 g
%</Scene>

%<Scene RGBColors /operator r /format {name 3}>
	/LandBrown .8 .7 .4 r
	/SeaBlue .1 .4 .6 r
	/ArrowRed 1 0 0 r
	/ArrowBlue .529 .808 .922 r
	/Blue 0 0 1 r
	/Yellow 1 1 0 r
	/Brown .6 .45 .2 r
%</Scene>

%<Scene CMYKColors /operator g /format {name 1}/>

	end
} def
%</Chapter>

%<Chapter VisitPowers /define def>
/VisitPowers {
	1 dict begin
	/p xd

%<Scene Powers /operator p /format {uname ustring name name}>
	/UNOWNED (?) /Brown /White p
%</Scene>

	end
} def
%</Chapter>

%<Chapter Controls>
/Controls {

%<Act Controls>
	/ChangeController true def
%</Act>

} bd
%</Chapter>

%<Chapter DrawFleet /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawFleet {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.1 .1 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintFleet>
	-26 -7 m -26 -2 l -19 -2 l -19 -1 l % to bow
	-22 -1 l -22 0 l -15 0 l -15 1 l % A turret
	-18 1 l -18 2 l -10 2 l -10 0 l % B turret
	-9 0 l -9 4 l -8 4 l -8 6 l % conn tower
	-6 6 l -6 5 l -5 5 l -5 9 l % Infra struct
	-3 9 l -3 14 l -2 14 l -2 9 l % funnel 1
	0 9 l 0 5 l 1 5 l 1 8 l % funnel 2
	3 8 l 3 13 l 4 13 l 4 8 l % mast 2
	6 8 l 6 0 l 8 0 l 8 2 l % funnel 2
	16 2 l 16 1 l 13 1 l 13 0 l % C turret
	20 0 l 20 -1 l 17 -1 l 17 -2 l % D turret
	23 -2 l 23 -3 l 25 -3 l 25 -5 l % stern
	24 -5 l 24 -7 l p
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawArmy /$StrokeUnit { Controlled { s 6 $PaintScaleFactor div w>
%<+ Outer k r } if 2 $PaintScaleFactor div w Contrast k } /$FillUnit {Paint f}>
/DrawArmy {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s t

%<Sketch LocateTroop>
	%$ $MapUnitScale dup x
	.1 .1 x
	%$ $MapUnitOffsetX $MapUnitOffsetY t
	0 8 t
%</Sketch>

%<Sketch PaintArmy>
	n 0 0 9 0 360 a p % wheel
	%$ $StrokeUnit
	Controlled { s 6 w Outer k r } if 2 w Contrast k
	-20 7 m 10 7 l 10 3 l 14 3 l
	14 1 l -16 1 l -16 3 l -20 3 l p % barrel
	4 2 m 24 -8 l 26 -8 l 18 -8 l -2 2 l % carriage
	%$ s $StrokeUnit r $FillUnit
	s Controlled { s 6 w Outer k r } if 2 w Contrast k r Paint f
	n 0 0 9 0 360 a p % wheel
	%$ $FillUnit
	Paint f
%</Sketch>

%<Act PaintLetter>
	Offset aload pop m
	MapUnitLetterFont z
	Contrast Letter h
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter DrawAlias>
/DrawAlias {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s
	3 1 roll t

%<Sketch LocateName>
	%$ $MapNameScale dup x
	.1 .1 x
	%$ $MapNameOffsetX $MapNameOffsetY t
	0 -14 t
%</Sketch>

%<Act PaintName>
	MapNameFont z
	dup stringwidth pop -2 div 0 neg m h
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawName>
/DrawName {
	pop pop pop

%<Part none/>

} bd
%</Chapter>

%<Chapter VisitTerritories /format {ustring value value} /$NumberOfScenes 0>
%<+ /define def>
/VisitTerritories {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter VisitSupplies /format {uname value value} /$NumberOfScenes 0 /define>
%<+ def>
/VisitSupplies {
	%$ $NumberOfScenes dict begin
	0 dict begin

%<Act Operators/>

	end
} def
%</Chapter>

%<Chapter supply>
/supply {
	%$ $SwitchToMapMode
	SwitchToMapMode
	Power begin
	s
	t

%<Sketch LocateSupply>
	%$ $MapSupplyScale dup x
	.1 .1 x
%</Sketch>

%<Act PaintControllableSupply>
	Controlled {
		Outer
		n 0 0 8 0 360 a f
		Contrast
		n 0 0 6 0 360 a f
	} if
	Paint
	n 0 0 4 0 360 a f
%</Act>

	r
	end
} bd
%</Chapter>

%<Chapter SplitString>
/SplitString {

%<Sketch SplitString>
	7 dict begin
	/nrChars xd
	/indentString xd
	/objectString xd
	/objectLast objectString length 1 sub def
	% Short string?
	objectLast nrChars lt {
		false objectString
	} {
		% Look for a suitable place to split.
		% First tracking backwards, if that doesn't work, look forward.
		/splitIndex -1 def
		nrChars -1 0 {
			%$ objectString 1 index get $SpaceChar eq {
			objectString 1 index get 32 eq {
				/splitIndex xd exit
			} if pop
		} for splitIndex -1 eq {
			nrChars 1 add 1 objectLast {
				%$ objectString 1 index get $SpaceChar eq {
				objectString 1 index get 32 eq {
					/splitIndex xd exit
				} if pop
			} for
		} if
		splitIndex -1 eq splitIndex objectLast eq or {
			false objectString
		} {
			% The first part.
			objectString 0 splitIndex getinterval
			% The second part.
			objectString splitIndex 1 add objectLast splitIndex sub getinterval
			% Add indentation if needed.
			indentString length 0 gt {
				dup length indentString length add string
				dup 0 indentString putinterval
				dup indentString length 4 3 roll putinterval
			} if
			% Add white space of the first part.
			/nonSpaceIndex objectLast 1 add def
			0 1 objectLast {
				%$ objectString 1 index get $SpaceChar ne {
				objectString 1 index get 32 ne {
					/nonSpaceIndex xd exit
				} if pop
			} for
			nonSpaceIndex 0 gt nonSpaceIndex splitIndex lt and {
				dup length nonSpaceIndex add string
				dup 0 objectString 0 nonSpaceIndex getinterval putinterval
				dup nonSpaceIndex 4 3 roll putinterval
			} if
			exch true exch
		} ifelse
	} ifelse
	end
%</Sketch>

} bd
%</Chapter>

%<FrameLayout PageLayout /$SetTextFont {TextFixedFont $TextFontSize# y z}>
%<+ /references { Map { ImageGrid ImageFrame Image } { Left Bottom Width Height>
%<+ ImageScale FrameLeft FrameBottom FrameWidth FrameHeight } } /layout>
%<+ ImageGrid /$MapImageScale 7.42105263 /marginWidth 20 /$MapBottom 24 /height>
%<+ $PageHeight /$TextFontSize 8 /$MapLeft 169.65789474 /marginHeight 20 /type>
%<+ proc /width $PageWidth /fitWidth 1 /define bd /fitHeight 1>
%<+ /$ClipAndTransformToMap { $MapImageScale#4 dup x>
%<+ {$MapLeft $MapImageScale div $MapImageLeft sub}#>
%<+ {$MapBottom $MapImageScale div $MapImageBottom sub}# t }>

%<Chapter DrawLayoutBorders>
/DrawLayoutBorders {
	s
	%$ $SetTextFont
	TextFixedFont 8 y z

%<Part none/>

	r
} bd
%</Chapter>

%<GridLayout ImageGrid /cellWidth $TextFontWidth /cellHeight $TextFontHeight>
%<+ /fitWidth 2 /fitHeight 2 /layout ImageFrame>

%<FrameLayout ImageFrame /marginWidth $FrameMargin /fitWidth 2 /fitHeight 2>
%<+ /layout Image /marginHeight $FrameMargin>

%<ImageLayout Image /widthPriority 5 /imageWidth $MapImageWidth /imageHeight>
%<+ $MapImageHeight /heightPriority 5>
%</ImageLayout>

%</FrameLayout>

%</GridLayout>

%<Chapter OwnerReport>
/OwnerReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOwner>
/WriteOwner {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter AdjustReport>
/AdjustReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteAdjust>
/WriteAdjust {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter RetreatReport>
/RetreatReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteRetreat>
/WriteRetreat {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter OrderReport>
/OrderReport {

%<Part none/>

} bd
%</Chapter>

%<Chapter WriteOrder>
/WriteOrder {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawTitle>
/DrawTitle {
	pop

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToTextMode>
/SwitchToTextMode {
	InTextMode {
		FinishReport /FinishReport { } def
	} {
		r /InTextMode true def
	} ifelse

%<Part none/>

} bd
%</Chapter>

%<Chapter SwitchToMapMode>
/SwitchToMapMode {
	InTextMode {
		FinishReport /FinishReport { } def
		/InTextMode false def
		s
		%$ $ClipAndTransformToMap
		7.4211 7.4211 x 22.86 3.23 t
	} if

%<Part none/>

} bd
%</Chapter>

%</FrameLayout>

%<Chapter PaintMap>
/PaintMap {
	%$ $SwitchToMapMode
	SwitchToMapMode
	s

%<Act PaintOutlines>
	IncludeNaval
%</Act>

	r
} bd
%</Chapter>

%<Chapter DrawMap>
/DrawMap {
	PageSetup
	PaintMap
	NumberLocations

%<Part none/>

} bd
%</Chapter>

%<Chapter DrawAliases>
/DrawAliases {

%<Part none/>

} bd
%</Chapter>

%<Chapter PrintNumber>
/PrintNumber {

%<Sketch PrintNumber>
	n
	%$ $MaxNumberLength string cvs dup 4 1 roll 0 0 m true charpath pathbbox n
	4 string cvs dup 4 1 roll 0 0 m true charpath pathbbox n
	3 -1 roll add 2 div 3 1 roll add 2 div exch
	3 -1 roll sub neg 3 1 roll sub exch m h
%</Sketch>

} bd
%</Chapter>

%<Chapter NumberLocations>
/NumberLocations {
	%$ $SwitchToMapMode
	SwitchToMapMode
	3 dict begin
	/bn 1 def /en /pop ld
	/nr { 2 index PrintNumber 1 add } bd
	s
	%$ MapNumberFont $MapNumberScale y z
	MapNumberFont .1 y z

%<Play Dots>
	Blue bn

%<Scene Numbers /operator nr /format {value value}>
	34.5 63.5 nr
	36.5 57.5 nr
	27.5 55.5 nr
	34.5 55.5 nr
	37.5 55.5 nr
	41.5 55.5 nr
	44.5 55.5 nr
	17.5 53.5 nr
	19.5 53.5 nr
	34.5 52.5 nr
	30.5 51.5 nr
	37.5 50.5 nr
	41.5 49.5 nr
	14.5 48.5 nr
	17.5 48.5 nr
	19.5 48.5 nr
	22.5 48.5 nr
	45.5 48.5 nr
	50.5 48.5 nr
	14.5 45.5 nr
	17.5 44.5 nr
	19.5 44.5 nr
	23.5 43.5 nr
	40.5 43.5 nr
	44.5 43.5 nr
	47.5 43.5 nr
	27.5 39.5 nr
	11.5 37.5 nr
	23.5 34.5 nr
	53.5 33.5 nr
	26.5 32.5 nr
	31.5 31.5 nr
	50.5 31.5 nr
	26.5 29.5 nr
	32.5 29.5 nr
	37.5 29.5 nr
	48.5 28.5 nr
	50.5 28.5 nr
	5.5 27.5 nr
	22.5 27.5 nr
	56.5 26.5 nr
	20.5 25.5 nr
	8.5 23.5 nr
	53.5 23.5 nr
	.5 22.5 nr
	56.5 22.5 nr
	55.5 21.5 nr
	5.5 17.5 nr
	8.5 17.5 nr
	55.5 15.5 nr
	5.5 13.5 nr
	8.5 12.5 nr
	58.5 12.5 nr
	11.5 9.5 nr
	58.5 7.5 nr
	11.5 4.5 nr
	56.5 4.5 nr
	54.5 3.5 nr
%</Scene>

	en
%</Play>

	r
	end
} bd
%</Chapter>

%<Chapter IncludeNaval>
/IncludeNaval {
	s
	/fk {
		p
		s Yellow f r
		k
	} bd
	%$ {5 $MapDrawingScale mul}# w Black
	.5 w Black
	ShapeContour

%<Part none/>

	r
} bd
%</Chapter>

%</Play>

%<Play Outlines /define bd/>

%<Play Shapes /define bd>

%<Chapter ShapeContour>
/ShapeContour {
	12 4 m
	12 10 l
	9 13 l
	6 14 l
	6 18 l
	9 18 l
	9 24 l
	2 23 l
	7 17 l
	6 17 l
	1 23 l
	6 28 l
	12 38 l
	15 46 l
	19 45 l
	19 49 l
	16 49 l
	15 50 l
	19 50 l
	19 56 l
	20 56 l
	20 50 l
	24 50 l
	23 49 l
	20 49 l
	20 45 l
	24 44 l
	24 35 l
	27 30 l
	33 30 l
	33 33 l
	25 33 l
	28 40 l
	31 52 l
	35 51 l
	35 55 l
	30 55 l
	29 56 l
	35 56 l
	35 64 l
	36 64 l
	36 57 l
	36 56 l
	42 56 l
	41 55 l
	36 55 l
	36 51 l
	41 50 l
	41 33 l
	36 33 l
	36 30 l
	39 30 l
	41 44 l
	45 44 l
	45 48 l
	41 48 l
	41 49 l
	45 49 l
	45 56 l
	46 56 l
	46 49 l
	51 49 l
	50 48 l
	46 48 l
	46 44 l
	48 44 l
	49 29 l
	51 29 l
	51 32 l
	54 34 l
	54 24 l
	57 27 l
	57 23 l
	56 22 l
	56 16 l
	59 13 l
	59 8 l
	57 5 l
	55 4 l
	fk

%<Part none/>

} bd
%</Chapter>

%</Play>

%<Play Installations>

%<Act DefineColors>
{
	currentdict end 3 1 roll [ exch /setgray load ] cvx def begin
}{
	currentdict end 5 1 roll [ 4 1 roll /setrgbcolor load ] cvx def begin
}{
	currentdict end 6 1 roll [ 5 1 roll /setcmykcolor load ] cvx def begin
} bind VisitColors
%</Act>

%<Sketch DefinePowers /$InitController {/ChangeController false def} /$Push {}>
%<+ /$AddController { dup /Controlled ChangeController put ChangeController {>
%<+ dup /Outer Power /Paint get put /ChangeController false def } if } /$Pull {>
%<+ } /$CreatePowerDict { 4 dict begin /Contrast xd /Paint xd /Offset xd>
%<+ /Letter xd currentdict end } /$GetLetterOffset { [ exch n 0 0 m true>
%<+ charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] }>
s
MapUnitLetterFont z
{
	%$ $Push exch load exch load
	exch load exch load
	%$ 2 index $GetLetterOffset 3 1 roll $Pull
	2 index [ exch n 0 0 m true charpath pathbbox 3 2 roll add -2 div 3 1 roll add -2 div exch ] 3 1 roll
	%$ $CreatePowerDict
	4 dict begin /Contrast xd /Paint xd /Offset xd /Letter xd currentdict end
	%$ [ /Power 3 2 roll { $AddController } /exec load /def load ] cvx
	[ /Power 3 2 roll { dup /Controlled ChangeController put ChangeController { dup /Outer Power /Paint get put /ChangeController false def } if } /exec load /def load ] cvx
	currentdict end 3 1 roll def begin
} VisitPowers
r
%$ $InitController
/ChangeController false def
%</Sketch>

%<Scene Centers /operator ld /format {uname uname}>
/UNOWNEDCENTER /UNOWNED ld
%</Scene>

%</Play>

%</Play>
%%EndSetup

%%Page: Opening 1
%<Play Page>
DrawMap

%<Part none/>

ShowPage
%</Play>

%%Trailer
%%Pages: 1
